# from rest_framework import serializers
#
# from course.models import CategoryModel, CourseModel
# from drf_haystack.serializers import HaystackSerializer
# from .search_indexes import CourseIndex
#
# class Category(serializers.ModelSerializer):
#     class Meta:
#         model = CategoryModel
#         fields = ["cname","id"]
#
#
# class CategorySerializer(serializers.ModelSerializer):
#     children = Category(many=True)
#     class Meta:
#         model = CategoryModel
#         fields = '__all__'
#
# class CourseSerializer(serializers.ModelSerializer):
#     tea = serializers.SerializerMethodField(read_only=True)
#     def get_tea(self,obj):
#         return {"tname":obj.teacher.tname,"job":obj.teacher.job,"headimg":"http://127.0.0.1:8000"+str(obj.teacher.headimg)}
#     class Meta:
#         model = CourseModel
#         fields = '__all__'
#
# from drf_haystack.serializers import HaystackSerializer
# from .search_indexes import CourseIndex
#
# class CourseIndexSerializer(HaystackSerializer):
#     class Meta:
#         index_classes = [CourseIndex]
#         fields = ["id","cname","text","content",'cover']
